package hc.bre.rest.admin

import hc.bre.cmn.ListOption

@groovy.transform.CompileStatic
enum PermissionType {
	rule,func
}

@groovy.transform.CompileStatic
enum BrePermission {
	create('创建'),
	read('装载'),
	update('更新'),
	delete('删除'),
	run('运行'),
	publish('发布'),
	
	authAdmin('权限管理',PermissionType.func)

	String desc
	PermissionType type
	BrePermission(String name , int ordinal, String desc) {
		super(name,ordinal);
		this.desc = desc;
		this.type = PermissionType.rule;
	}

	BrePermission(String name , int ordinal, String desc, PermissionType type) {
		super(name,ordinal);
		this.desc = desc;
		this.type = type;
	}

	static List<Map> list() {
		List<LinkedHashMap> lst = BrePermission.values().collect{
			return [id:it.ordinal(),code:it.name(),name:it.desc,type:it.type];
		}
		return lst as List<Map>;
	}
}
